/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.chart.ASalesType;
import com.thor.palmmall.spi.chart.SSalesType;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class ASalesTypeConverter implements Converter<SSalesType, ASalesType> {

  public static ASalesTypeConverter getInstance() {
    if (instance == null)
      instance = new ASalesTypeConverter();
    return instance;
  }

  private static ASalesTypeConverter instance;

  private ASalesTypeConverter() {
  }

  @Override
  public ASalesType convert(SSalesType source) {
    if (source == null) {
      return null;
    }
    ASalesType target = new ASalesType();
    target.setSales(source.getSales());
    target.setUcn(UCN.newInstance(source.getUcn()));
    return target;
  }

}
